import api from '../../request/api'
export default {
    namespaced: true,
    state() {
        return {
            adminlists: [],
            totalsnum: 0
        }
    },
    mutations: {
        setState(state: any, adminlists: any) {
            state.adminlists = adminlists
        },
        INITADMINNUM(state: any, totalsnum: any) {
            state.totalsnum = totalsnum
        }
    },
    actions: {
        getadminlist(context: any, data: any) {
            api.userlist(data).then((res: any) => {
                if (res.code == 200) {
                    context.commit("setState", res.list)
                }
            })

        },
        gettotalsnum(context: any) {
            api.usercount().then((res: any) => {
                if (res.code == 200) {
                    context.commit("INITADMINNUM", res.list[0].total)
                }
            })

        }
    },
    getters: {
        adminlists(state: any) {
            return state.adminlists
        },
        totalsnum(state: any) {
            return state.totalsnum
        },

    }

}